var utils = require('../../../utils/util.js')
var c = require('../../../utils/config.js')
Page({

  /**
   * 页面的初始数据
   */
  data: {
    entityshop:[],
    vipshop:[],
    supplyshop:[],
    shopapply:[],
    userinfo: [],
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.loaddata();
    utils.checkLogin();
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
    
  }, 

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    this.loaddata();
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
  
  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
  
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
  
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
  
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
  
  },

  entityshop:function(){
    wx.showToast({
      title: "还未开放",
      icon: "none"
    })
  },

  loaddata:function(){
    var that = this;
    var token = wx.getStorageSync("userinfo").wap_token;
    var data = {
      url: "/zfcom/com/getword",
      uuid: "",
    };
    utils.request(data).then(function (res) {
      if (res.code == 0) {
        var data = res.data;
        that.setData({
          entityshop: data.entityshop,
          vipshop: data.vipshop,
          supplyshop: data.supplyshop,
        });
      } else {

      }
    });

    var data = {
      url: "/zfshop/shopapply/details",
      token: token,
    };
    utils.request(data).then(function (res) {
      if (res.code == 0) {
        var data = res.data;
        that.setData({
          shopapply: data,
        });
      } else {
      
      }
    });

    var data = {
      url: "/yluser/user/gettokenuserinfo",
      token: token,
    };
    utils.request(data).then(function (res) {
      if (res.code == 0) {
        var data = res.data;
        that.setData({
          userinfo: data,
        });
      } else {

      }
    });
  }
})